<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>ajax</title>
    <script type="text/javascript">
        window.onload = init;
        function init() {
            var btn = document.getElementById("getData")
            btn.onclick = getData;
        }

        function getData() {
            alert(this.value);
        }
    </script>
</head>
<body>
<input type="button" value="获取数据" id="getData"/>

<div id="serverData">

</div>
</body>
</html>